package allowed_requrl

import (
	"pd/utils"
	"time"
)

const AppName = "allowed_requrl"

// 根据name创建
type Allowed_requrl struct {
	Id          int       `json:"id"`
	Name        []string  `json:"name" validate:"required"`
	Create_time time.Time `json:"create_time"`
	Update_time time.Time `json:"update_time"`
	Admin       string    `json:"admin"`
	Remark      string    `json:"remark"`
	Status      int       `json:"status"`
}

func NewAllowed_requrl() *Allowed_requrl {
	return &Allowed_requrl{
		Name: []string{},
	}
}

// 设置默认值
func (d *Allowed_requrl) InjectDefualt() {
	// 设置时间的默认值
	if d.Create_time == utils.NilTime {
		d.Create_time = time.Now()
		d.Update_time = time.Now()
	}
	// 设置状态，1代表创建，2代表删除
	if d.Status == 0 {
		d.Status = 1
	}
}
